// Copyright  2004-2008 Backplane Ltd.
//
// This file is part of Ubiquity formsPlayer
//
// Ubiquity formsPlayer is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3 of the License, or (at your
// option) any later version.
//
// Ubiquity formsPlayer is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License
// along with Ubiquity formsPlayer If not, see <http://www.gnu.org/licenses/>.
//	
//
//   Purpose: declaration of CXFormsElementGroup.
//   $Id$


#ifndef GROUP_UI_INCLUDED
#define GROUP_UI_INCLUDED 1
#pragma once

#include "XFormsElementWithXBLImpl.h"
#include "parseGroup.h"
#include "implgroup.h"
#include <list>
typedef std::list< CComPtr<IHTMLElement> > CListOfIHTMLElements;

class CXFormsElementGroup : 
	public CElementWithXBL //CXFormsElementWithXBLImpl<CImplGroup,CXFormsParseGroup>
,public IDispatchImpl<IEventListener,&IID_IEventListener,&LIBID_DOM2EventsLib,2,0>

{
public:
	BEGIN_COM_MAP(CXFormsElementGroup)
		COM_INTERFACE_ENTRY(IEventListener)
		COM_INTERFACE_ENTRY_CHAIN(CElementWithXBL)
	END_COM_MAP()

	CXFormsElementGroup();
	virtual ~CXFormsElementGroup();
	virtual CImpl* CreateImpl();
	virtual CXFormsParse* CreateParse(CImpl* pImpl);
	virtual HRESULT InitBehaviour();
	virtual HRESULT put_XPathExpression(const BSTR bsXPath);
	virtual HRESULT attachEvents(void);
	virtual HRESULT detachEvents(void);
	virtual HRESULT DocumentReady(void);
	HRESULT AddOutOfLineElement(IHTMLElement * pEl);
	virtual HRESULT highlight(bool bApply, bool bFocus);
	
	//DOM2EventsLib::IEventListener
	STDMETHOD(handleEvent)(IDOMEvent *pEvt);
	virtual HRESULT getXML(IXMLDOMNode ** ppXML);

protected:
	virtual HRESULT render();
	virtual HRESULT handleEvent(CComBSTR& sEventName, IHTMLEventObj2 * pEventObject,VARIANT * pvarResult);

	virtual void RegisterFindBehaviourRefusal();
	virtual void RegisterFindBehaviourAcceptance();
private:
	CListOfIHTMLElements * m_pOutOfLineElements;

};
#endif